package com.liuhangkai.firstpro.jwt;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.*;

import java.util.List;


@Configuration
public class WebConfig implements WebMvcConfigurer {

    /**
     * 添加jwt拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor())
                // 拦截所有请求，通过判断是否有 @JwtToken 注解 决定是否需要登录
                .addPathPatterns("/a/**");
    }

    /**
     * jwt拦截器
     * @return
     */
    @Bean
    public JwtInterceptor jwtInterceptor() {
        return new JwtInterceptor();
    }


    //下面基本不用
    public MessageCodesResolver getMessageCodesResolver(){
        return null;
    }

    public void configurePathMatch(PathMatchConfigurer var1){}

   public void configureContentNegotiation(ContentNegotiationConfigurer var1){}
    public void configureAsyncSupport(AsyncSupportConfigurer var1){}

   public void configureDefaultServletHandling(DefaultServletHandlerConfigurer var1){}
   public   void addFormatters(FormatterRegistry var1){}

   public void addResourceHandlers(ResourceHandlerRegistry var1){}

   public void addCorsMappings(CorsRegistry var1){}

   public void addViewControllers(ViewControllerRegistry var1){}

   public void configureViewResolvers(ViewResolverRegistry var1){}

   public void addArgumentResolvers(List<HandlerMethodArgumentResolver> var1){}

   public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> var1){}

   public void configureMessageConverters(List<HttpMessageConverter<?>> var1){}

  public   void extendMessageConverters(List<HttpMessageConverter<?>> var1){}

    public  void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> var1){}

   public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> var1){}

   public Validator getValidator(){return null;}


}
